package game.gui.buttons;

import game.MainGame.WorldMemoryGame;

import java.awt.Color;
import java.util.ArrayList;
import javax.swing.JOptionPane;

public class FirstLbl extends GameLbl {
	
	private static final long serialVersionUID = 1L;
	protected static ArrayList<FirstLbl> buttons = new ArrayList<FirstLbl>();
	protected int index;
	protected String name;
	protected Color color;
	protected int rightAnswer;
	protected String users;
	protected String category;

	public String getCategory() {
		return category;
	}

	public FirstLbl(int i, WorldMemoryGame w) {
		buttons.add(this);
		this.addActionListener(w);
		this.index = i;
	}

	public int getRightAnswer() {
		return rightAnswer;
	}

	public static ArrayList<FirstLbl> getButtons() {
		return buttons;
	}

	public int getIndex() {
		return index;
	}

	public Color getColor() {
		return color;
	}

	public void activate() {
		this.setEnabled(true);
		this.setBackground(getBackground().brighter());
	}

	public void unactivate() {
		this.setEnabled(false);
		this.setBackground(this.getColor());
	}

	public boolean popQuestion(WorldMemoryGame w) {
		JOptionPane.showMessageDialog(w, "");
		return false;
	}

	public void addPlayer(int i) {
		setText(getText() + Integer.toString(i));
		setForeground(new Color(0, 0, 0));
	}

	public void removePlayer(int i) {
		String id = Integer.toString(i);
		if (getText().contains(id)) {
			setText(getText().replaceFirst(id, ""));
		}
	}

}
